package dataImport.model;

import dataImport.model.abstracts.AbstractEntity;


public class Requirement extends AbstractEntity {

	private static final long serialVersionUID = 4601847664306342284L;

	private CustomAction customAction;

	private StaticRequirement staticRequirement;

	private AbstractEntity abstractEntity;

	public Requirement(final CustomAction customAction, final StaticRequirement staticRequirement, final AbstractEntity abstractEntity) {
		super(createId(customAction.getId(), staticRequirement.getName(), abstractEntity.getId()));
		this.customAction = customAction;
		this.staticRequirement = staticRequirement;
		this.abstractEntity = abstractEntity;
	}

	public CustomAction getCustomAction() {
		return this.customAction;
	}

	public void setCustomAction(CustomAction customAction) {
		this.customAction = customAction;
	}

	public StaticRequirement getStaticRequirement() {
		return this.staticRequirement;
	}

	public void setStaticRequirement(StaticRequirement staticRequirement) {
		this.staticRequirement = staticRequirement;
	}

	public AbstractEntity getAbstractEntity() {
		return this.abstractEntity;
	}

	public void setAbstractEntity(AbstractEntity abstractEntity) {
		this.abstractEntity = abstractEntity;
	}

	@Override
	public int hashCode() {
		final int prime = 31;
		int result = super.hashCode();
		result = prime * result + ((this.abstractEntity == null) ? 0 : this.abstractEntity.hashCode());
		result = prime * result + ((this.customAction == null) ? 0 : this.customAction.hashCode());
		result = prime * result + ((this.staticRequirement == null) ? 0 : this.staticRequirement.hashCode());
		return result;
	}

	@Override
	public boolean equals(java.lang.Object obj) {
		if (this == obj) {
			return true;
		}
		if (!super.equals(obj)) {
			return false;
		}
		if (this.getClass() != obj.getClass()) {
			return false;
		}
		Requirement other = (Requirement) obj;
		if (this.abstractEntity == null) {
			if (other.abstractEntity != null) {
				return false;
			}
		}
		else if (!this.abstractEntity.equals(other.abstractEntity)) {
			return false;
		}
		if (this.customAction == null) {
			if (other.customAction != null) {
				return false;
			}
		}
		else if (!this.customAction.equals(other.customAction)) {
			return false;
		}
		if (this.staticRequirement != other.staticRequirement) {
			return false;
		}
		return true;
	}

}
